Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

258
Visualizações
What does it mean when a function is written like "name: function ()"?

I just have a super quick question about JavaScript so I'm not going to follow the general formatting of a question like usual.

I'm trying to understand some code in JavaScript, and the person who wrote it used a method that I'm not familiar with. As you see in the title, they've written it by typing the name of the function followed by a colon first, and then writing the actual function.

Example: myFunction: function () {}

Is anyone able to tell me what this means, why it's done, and what it accomplishes?

about 4 years ago · Santiago Trujillo
2 Respostas
Responde à pergunta

0

It is part of Object Methods like:

const person = {
  myFunction: function() {}
};

you can invoke myfunction by using person.myFunction()

about 4 years ago · Santiago Trujillo Relatório

0

There are 3 ways of writing a function in JavaScript:

function myFunction() {} // Function Declaration
myFunction: function () {} // Function Expression
myFunction = () => {} // Arrow Function
about 4 years ago · Santiago Trujillo Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda